package com.lcj.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class AdviceController {

    @ExceptionHandler(ArithmeticException.class)
    public String exception1(Exception e){
        System.out.println("服务器异常，发短信+"+e.getMessage());
        return "500";
    }

    @ExceptionHandler(NullPointerException.class)
    public String exception2(Exception e){
        System.out.println("服务器异常，打断话+"+e.getMessage());
        return "500";
    }

    @ExceptionHandler(ClassNotFoundException.class)
    public String exception3(Exception e){
        System.out.println("服务器异常，发邮件+"+e.getMessage());
        return "500";
    }
}
